// Created on 2008/02/24
// Last Updated on 2008/02/24

/* Things to be done
 ** Finish up this DataStructure for Dialogues 
 * 
 */


package gameUtils;
import gameInterface.DialogueQueueWithLinearList;

public class DialogueQueue implements DialogueQueueWithLinearList {

	private DialogueNode _frontEntity;
	private DialogueNode _rearEntity;
	public int queueSize;
	
	public DialogueNode addEntity(DialogueNode newRearEntity) {
		// Add a new Element to the Queue
		_rearEntity.nextEntity = newRearEntity;
		_rearEntity = newRearEntity;
		return null;
	}

	public void closeQueue() {
		// This pretty much is a deconstructor...
		
		_frontEntity = null;
		_rearEntity = null;
		queueSize = 0;
	}

	public boolean isEmpty() {
		// Is the Queue Empty??
		if(_frontEntity == null){
			return true;
		}else{
			return false;
		}
	}

	public DialogueNode peekEntity() {
		// Look @ the front entity
		return _frontEntity;
	}

	public void removeEntity() {
		// Remove the front entity
		_frontEntity = _frontEntity.nextEntity;
		queueSize--;
	}
	
	public String toString(){
		return "Front Entity" + "\n" + _frontEntity.toString() + "\n" + "Rear Entity" + _rearEntity.toString() + "Queue Size: " + queueSize;
	}
	
	public DialogueQueue(){
		this.queueSize = 0;
	}

}
